#python 3.5.5安装

#安装依赖库
sudo apt install build-essential -y
sudo apt install checkinstall -y
sudo apt install libreadline-gplv2-dev -y
sudo apt install libncursesw5-dev -y
sudo apt install libssl-dev -y
sudo apt install libsqlite3-dev -y
sudo apt install tk-dev -y
sudo apt install libgdbm-dev -y
sudo apt install libc6-dev -y
sudo apt install libbz2-dev -y
sudo apt install libffi-dev
sudo apt install libmagic-mgc
sudo apt install libmagic1
sudo apt install libmpdec2

cd

#获取python源码
if [ ! -f ".\Python-3.5.5.tgz" ]; then
	#下载
	wget https://www.python.org/ftp/python/3.5.5/Python-3.5.5.tgz
fi

if [ ! -d "./Python-3.5.5" ]; then
	#解压
	tar xzf Python-3.5.5.tgz
fi

cd Python-3.5.5
#配置源码
./configure
#安装
make altinstall

cd /usr/bin/
#mv python python2.7.12
ln -s /usr/local/bin/python3.5 /usr/bin/python3
python3 -V

#自动获取最新版Python
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py

#修改国内源 
cd
mkdir ".pip"  
echo "[global]">>~/.pip/pip.conf
echo "index-url = https://mirrors.aliyun.com/pypi/simple">>~/.pip/pip.conf

pip3 install --upgrade pip

#我们需要修改下：
ln -s /usr/local/bin/pip3.5 /usr/bin/pip3

#版本管理
##update-alternatives --install /usr/bin/python python /usr/local/bin/python3.5.5 3


